﻿@{
    ViewBag.Title = "One Relationship";
}
@section head {
    <script type="text/javascript">
        $(function () {
            $.ajax({
                cache: false,
                url: "@Url.Action("GetOneRelationshipData", "Home")",
                type: "GET",
                success: function(result) {
                    var $tableBody = $("#tableBody");
                    $.each(result, function() {
                        var $td = $("<td />");
                        $td.text(this.ProductName);
                        var $td1 = $("<td />");
                        $td1.text(this.Categories.CategoryName);
                        var $tr = $("<tr />");
                        $tr.append($td);
                        $tr.append($td1);
                        $tableBody.append($tr);
                    });
                }
            });
        });
    </script>
}

<h2>One Relationship</h2>

<table>
    <thead>
        <tr>
            <th>Product Name</th>
            <th>Category Name</th>
        </tr>
    </thead>
    <tbody id="tableBody">
        
    </tbody>
</table>